package com.itheima.d6_tcp3;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

public class ClientThread implements Runnable{
    private Socket socket;
    public ClientThread(Socket socket) {
        this.socket = socket;
    }

    @Override
    public void run() {
        try {
            BufferedReader bufferedReader1 = new BufferedReader(new InputStreamReader(socket.getInputStream()));
            while (true) {
                String s = bufferedReader1.readLine();
                if (s != null) {
                    System.out.println("客户端收到消息：" + s);
                }

            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }


    }
}
